package net.kazed.nextaction.database;

import java.util.List;

import android.database.Cursor;

/**
 * Tree node with GtdContext contents.
 *
 * @author Koert Zeilstra
 */
public class ContextNode {

   private GtdContext context;
   private List<ContextNode> children;
   
   public ContextNode(GtdContext context, GtdProvider provider) {
      super();
      this.context = context;
      Cursor cursor = provider.query(GtdContext.CONTENT_URI, GtdContext.FULL_PROJECTION.getFieldNames(),
            GtdContext.PARENT_CONTEXT_ID + " = ?", new String[] {context.getId().toString()}, "ASC " + GtdContext.NAME);
      while(cursor.moveToNext()) {
         GtdContext childContext = new GtdContext(cursor);
         ContextNode childNode = new ContextNode(childContext, provider);
         children.add(childNode);
      }
   }
   
   
   
}
